import TreeTraversal.TreeNode;

public class diameterOfBinaryTree {
    int nums;
    public int BinaryTree(TreeNode root) {
        nums = 1;
        depth(root);
        return nums-1;
    }
    public int depth(TreeNode node){
        if(node == null){
            return 0;
        }
        int L = depth(node.left);
        int R = depth(node.right);
        nums = Math.max(nums,L+R+1);
        return Math.max(L,R)+1;
    }
}
